﻿using DocumentFormat.OpenXml.Bibliography;
using MOKA.TPM.Utility.Const;
using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace MOKA.TPM.Entity;

/// <summary>
/// </summary>
[Tenant(TPMConst.MESBaseDB)]
[SugarTable("Department", "部門")]
public class Department
{
    /// <summary>
    /// 部门ID
    /// </summary>
    [SugarColumn(ColumnName = "DepartmentId", ColumnDescription = "部门ID", Length = 50, IsPrimaryKey = true)]
    [Required, MaxLength(50)]
    public string DepartmentId { get; set; } = string.Empty;

    /// <summary>
    /// 父部门ID
    /// </summary>
    [SugarColumn(ColumnName = "ParentId", ColumnDescription = "父部门ID", Length = 50)]
    [MaxLength(50)]
    public string? ParentId { get; set; }

    /// <summary>
    /// 部门名称
    /// </summary>
    [SugarColumn(ColumnName = "DepartmentName", ColumnDescription = "部门名称", Length = 600)]
    [MaxLength(600)]
    public string? DepartmentName { get; set; }

    /// <summary>
    /// 部门子项
    /// </summary>
    [SugarColumn(IsIgnore = true)]
    public List<Department> Children { get; set; }
}